import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: Home,
    meta: {
      index: 1,
    },
  }, 
  {
    path: '/search',
    name: 'search',
    component: () =>  import('../views/home/search/index.vue'),
    meta: {
      index: 7,
    },
  }, 
  {
    path: '/product',
    name: 'product',
    component: () =>  import('../views/product/Product.vue'),
    meta: {
      index: 6,
    },
  },
  {
    path: '/product-list',
    name: 'productList',
    component: () =>  import('../views/product/ProductList.vue'),
    meta: {
      index: 5,
    },
  },
  {
    path: '/category',
    name: 'category',
    component: () =>  import('../views/category/index.vue'),
    meta: {
      index: 1,
    },
  },
  {
    path: '/cart',
    name: 'cart',
    component: () =>  import('../views/cart/index.vue'),
    meta: {
      index: 1,
    },
    
  },
  {
    path: '/my',
    name: 'my',
    component: () =>  import('../views/my/index.vue'),
    meta: {
      index: 1,
    },
  },
  {
    path: '/profile',
    name: 'profile',
    component: () =>  import('../views/my/Profile.vue'),
    meta: {
      index: 2,
    },
  },
  {
    path: '/address',
    name: 'address',
    component: () =>  import('../views/my/address/index.vue'),
    meta: {
      index: 7,
    },
  },
  {
    path: '/address-edit',
    name: 'addressEdit',
    component: () =>  import('../views/my/address/AddressEdit.vue'),
    meta: {
      index: 8,
    },
  },
  {
    path: '/order-list',
    name: 'orderList',
    component: () =>  import('../views/my/order/OrderList.vue'),
    meta: {
      index: 7,
    },
  },
  {
    path: '/order-detail',
    name: 'orderDetail',
    component: () =>  import('../views/my/order/OrderDetail.vue'),
    meta: {
      index: 8,
    },
  },
  {
    path: '/create-order',
    name: 'createOrder',
    component: () =>  import('../views/my/order/CreateOrder.vue'),
    meta: {
      index: 8,
    },
  },
  {
    path: '/login',
    name: 'login',
    component: () =>  import('../views/login/index.vue'),
    meta: { 
      index: 100,
    },
  },
  {
    path: '/register',
    name: 'register',
    component: () =>  import('../views/register/index.vue'),
    meta: { 
      index: 100,
    },
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
